<?php
/**
 * 论坛回帖管理
 * 张名尊， 20140505
 */ 

class threadRepliesAction extends backendAction
{
    public function _initialize() {
        parent::_initialize();
        $this->_name = 'thread_replies';
        $this->_mod = D('threadReplies');
    
    }

    public function _before_index() {
        $p = $this->_get('p','intval',1);
        $this->assign('p',$p);        
        //默认排序
        $this->sort = 'id';
        $this->order = 'desc';
        $this->list_relation = true;
    }

    protected function _search() {
        $map = array();
        ($time_start = $this->_request('time_start', 'trim')) && $map['addTime'][] = array('egt', strtotime($time_start));
        ($time_end = $this->_request('time_end', 'trim')) && $map['addTime'][] = array('elt', strtotime($time_end)+(24*60*60-1));
        $status = $this->_request('status', 'trim');
        if($status!=''){
            $map['status'] = $status;
        }
        ($keyword = $this->_request('keyword', 'trim')) && $map['title'] = array('like', '%'.$keyword.'%');
        $threadId = $this->_request('threadId', 'intval') ;
        $map['threadId'] = $threadId;
        $this->assign('search', array(
            'time_start' => $time_start,
            'time_end' => $time_end,         
            'status'  => $status,
            'keyword' => $keyword,
            'threadId'=>$threadId,
        ));
        return $map;
    }
    
    public function oppt(){
        $type = $this->_request('type');
        $this->assign('type',$type);
 
        $this->$type();
    }



 
}